T
IdeaBlade DevForce 2010 Help Reference
Or<T>(Expression<Func<T,Boolean>>[]) Method
See Also  Example Send Feedback
IdeaBlade.Linq Assembly > IdeaBlade.Linq Namespace > PredicateBuilder Class > Or Method : Or<T>(Expression<Func<T,Boolean>>[]) Method



expressions
Expressions to be OR'ed
Returns an expression which represents a conditional OR operation of the specified operands.

Syntax

Visual Basic (Declaration) 
Public Overloads Shared Function Or(Of T)( _
   ByVal ParamArray expressions() As Expression(Of Func(Of T,Boolean)) _
) As Expression(Of Func(Of T,Boolean))
Visual Basic (Usage)Copy Code
Dim expressions() As Expression(Of Func(Of T,Boolean))
Dim value As Expression(Of Func(Of T,Boolean))
 
value = PredicateBuilder.Or(Of T)(expressions)
C# 
public static Expression<Func<T,bool>> Or<T>( 
   params Expression<Func<T,bool>>[] expressions
)
C++/CLI 
public:
static Expression<Func<T^,bool>^>^ Orgeneric<typename T>
( 
   ... array<Expression<Func<T^,bool>^>^>^ expressions
) 

Parameters

expressions
Expressions to be OR'ed

Type Parameters

T

Example

C#Copy Code
public void OrQuery2() {
  var mgr = new DomainModelEntityManager();
  Expression<Func<Customer, bool>> crit1 = c => c.Country.Equals("Mexico");
  Expression<Func<Customer, bool>> crit2 = c => c.CompanyName.StartsWith("A");
  Expression<Func<Customer, bool>> crit3 = c => c.City.StartsWith("M");

  // 'or' all criteria.
  var finalcrit = PredicateBuilder.Or(crit1, crit2, crit3);
  var results = mgr.Customers.Where(finalcrit).ToList();
}

Remarks

The resulting expression is an "OrElse" binary expression of all operands provided.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.